﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Manager;
using UnityEngine;
using UnityEngine.EventSystems;

namespace Studio
{
	// Token: 0x0200042F RID: 1071
	public class CameraControl : MonoBehaviour
	{
		// Token: 0x06001A68 RID: 6760 RVA: 0x000A8A14 File Offset: 0x000A6C14
		public CameraControl()
		{
			this.cameraData.parse = 23f;
			this.cameraReset.parse = 23f;
		}

		// Token: 0x17000282 RID: 642
		// (get) Token: 0x06001A69 RID: 6761 RVA: 0x000A8AFC File Offset: 0x000A6CFC
		private int mapLayer
		{
			get
			{
				if (this.m_MapLayer == -1)
				{
					this.m_MapLayer = LayerMask.GetMask(new string[]
					{
						"Map",
						"MapNoShadow"
					});
				}
				return this.m_MapLayer;
			}
		}

		// Token: 0x17000283 RID: 643
		// (get) Token: 0x06001A6A RID: 6762 RVA: 0x000A8B34 File Offset: 0x000A6D34
		// (set) Token: 0x06001A6B RID: 6763 RVA: 0x000A8B3C File Offset: 0x000A6D3C
		public Camera mainCmaera { get; protected set; }

		// Token: 0x17000284 RID: 644
		// (get) Token: 0x06001A6C RID: 6764 RVA: 0x000A8B48 File Offset: 0x000A6D48
		public Camera subCamera
		{
			get
			{
				return this.m_SubCamera;
			}
		}

		// Token: 0x17000285 RID: 645
		// (get) Token: 0x06001A6D RID: 6765 RVA: 0x000A8B50 File Offset: 0x000A6D50
		// (set) Token: 0x06001A6E RID: 6766 RVA: 0x000A8B58 File Offset: 0x000A6D58
		public bool isControlNow { get; protected set; }

		// Token: 0x17000286 RID: 646
		// (get) Token: 0x06001A6F RID: 6767 RVA: 0x000A8B64 File Offset: 0x000A6D64
		// (set) Token: 0x06001A70 RID: 6768 RVA: 0x000A8B6C File Offset: 0x000A6D6C
		public bool isOutsideTargetTex { get; set; }

		// Token: 0x17000287 RID: 647
		// (get) Token: 0x06001A71 RID: 6769 RVA: 0x000A8B78 File Offset: 0x000A6D78
		// (set) Token: 0x06001A72 RID: 6770 RVA: 0x000A8B80 File Offset: 0x000A6D80
		public bool isCursorLock { get; set; }

		// Token: 0x17000288 RID: 648
		// (get) Token: 0x06001A73 RID: 6771 RVA: 0x000A8B8C File Offset: 0x000A6D8C
		// (set) Token: 0x06001A74 RID: 6772 RVA: 0x000A8B94 File Offset: 0x000A6D94
		public bool isConfigTargetTex { get; set; }

		// Token: 0x17000289 RID: 649
		// (get) Token: 0x06001A75 RID: 6773 RVA: 0x000A8BA0 File Offset: 0x000A6DA0
		// (set) Token: 0x06001A76 RID: 6774 RVA: 0x000A8BA8 File Offset: 0x000A6DA8
		public bool isConfigVanish
		{
			get
			{
				return this.m_ConfigVanish;
			}
			set
			{
				if (Utility.SetStruct<bool>(ref this.m_ConfigVanish, value))
				{
					this.VisibleFroceVanish(true);
				}
			}
		}

		// Token: 0x1700028A RID: 650
		// (get) Token: 0x06001A77 RID: 6775 RVA: 0x000A8BC4 File Offset: 0x000A6DC4
		public Transform targetTex
		{
			get
			{
				return this.m_TargetTex;
			}
		}

		// Token: 0x1700028B RID: 651
		// (get) Token: 0x06001A78 RID: 6776 RVA: 0x000A8BCC File Offset: 0x000A6DCC
		// (set) Token: 0x06001A79 RID: 6777 RVA: 0x000A8BDC File Offset: 0x000A6DDC
		public bool active
		{
			get
			{
				return this.objRoot.activeSelf;
			}
			set
			{
				this.objRoot.SetActive(value);
			}
		}

		// Token: 0x06001A7A RID: 6778 RVA: 0x000A8BEC File Offset: 0x000A6DEC
		public CameraControl.CameraData Export()
		{
			return new CameraControl.CameraData(this.cameraData);
		}

		// Token: 0x06001A7B RID: 6779 RVA: 0x000A8BFC File Offset: 0x000A6DFC
		public CameraControl.CameraData ExportResetData()
		{
			return new CameraControl.CameraData(this.cameraReset);
		}

		// Token: 0x06001A7C RID: 6780 RVA: 0x000A8C0C File Offset: 0x000A6E0C
		public void Import(CameraControl.CameraData _src)
		{
			if (_src == null)
			{
				return;
			}
			this.cameraData.Copy(_src);
			this.fieldOfView = this.cameraData.parse;
		}

		// Token: 0x06001A7D RID: 6781 RVA: 0x000A8C34 File Offset: 0x000A6E34
		public bool LoadVanish(string _assetbundle, string _file, GameObject _objMap)
		{
			this.lstMapVanish.Clear();
			return true;
		}

		// Token: 0x06001A7E RID: 6782 RVA: 0x000A8C44 File Offset: 0x000A6E44
		public void CloerListCollider()
		{
			this.listCollider.Clear();
			this.lstMapVanish.Clear();
		}

		// Token: 0x06001A7F RID: 6783 RVA: 0x000A8C5C File Offset: 0x000A6E5C
		public void VisibleFroceVanish(bool _visible)
		{
			foreach (CameraControl.VisibleObject visibleObject in this.lstMapVanish)
			{
				foreach (GameObject gameObject in from x in visibleObject.listObj
				where x != null
				select x)
				{
					gameObject.SetActive(_visible);
				}
				visibleObject.isVisible = _visible;
				visibleObject.delay = ((!_visible) ? 0f : 0.3f);
			}
		}

		// Token: 0x06001A80 RID: 6784 RVA: 0x000A8D40 File Offset: 0x000A6F40
		private void VisibleFroceVanish(CameraControl.VisibleObject _obj, bool _visible)
		{
			if (_obj == null)
			{
				return;
			}
			if (_obj.listObj == null)
			{
				return;
			}
			int count = _obj.listObj.Count;
			for (int i = 0; i < count; i++)
			{
				if (_obj.listObj[i].activeSelf != _visible)
				{
					_obj.listObj[i].SetActive(_visible);
				}
			}
			_obj.delay = ((!_visible) ? 0f : 0.3f);
			_obj.isVisible = _visible;
		}

		// Token: 0x06001A81 RID: 6785 RVA: 0x000A8DCC File Offset: 0x000A6FCC
		private void VanishProc()
		{
			if (!this.isConfigVanish)
			{
				return;
			}
			using (List<CameraControl.VisibleObject>.Enumerator enumerator = this.lstMapVanish.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					CameraControl.VisibleObject v = enumerator.Current;
					Collider x2 = this.listCollider.Find((Collider x) => v.nameCollider == x.name);
					if (x2 == null)
					{
						this.VanishDelayVisible(v);
					}
					else if (v.isVisible)
					{
						this.VisibleFroceVanish(v, false);
					}
				}
			}
		}

		// Token: 0x06001A82 RID: 6786 RVA: 0x000A8E90 File Offset: 0x000A7090
		private void VanishDelayVisible(CameraControl.VisibleObject _visible)
		{
			if (_visible.isVisible)
			{
				return;
			}
			_visible.delay += Time.deltaTime;
			if (_visible.delay >= 0.3f)
			{
				this.VisibleFroceVanish(_visible, true);
			}
		}

		// Token: 0x1700028C RID: 652
		// (get) Token: 0x06001A83 RID: 6787 RVA: 0x000A8EC8 File Offset: 0x000A70C8
		// (set) Token: 0x06001A84 RID: 6788 RVA: 0x000A8ED8 File Offset: 0x000A70D8
		public Vector3 targetPos
		{
			get
			{
				return this.cameraData.pos;
			}
			set
			{
				this.cameraData.pos = value;
			}
		}

		// Token: 0x1700028D RID: 653
		// (get) Token: 0x06001A85 RID: 6789 RVA: 0x000A8EE8 File Offset: 0x000A70E8
		// (set) Token: 0x06001A86 RID: 6790 RVA: 0x000A8EF8 File Offset: 0x000A70F8
		public Vector3 cameraAngle
		{
			get
			{
				return this.cameraData.rotate;
			}
			set
			{
				base.transform.rotation = Quaternion.Euler(value);
				this.cameraData.rotate = value;
			}
		}

		// Token: 0x1700028E RID: 654
		// (get) Token: 0x06001A87 RID: 6791 RVA: 0x000A8F18 File Offset: 0x000A7118
		// (set) Token: 0x06001A88 RID: 6792 RVA: 0x000A8F28 File Offset: 0x000A7128
		public float fieldOfView
		{
			get
			{
				return this.cameraData.parse;
			}
			set
			{
				this.cameraData.parse = value;
				if (this.mainCmaera != null)
				{
					this.mainCmaera.fieldOfView = value;
				}
				if (this.subCamera != null)
				{
					this.subCamera.fieldOfView = value;
				}
			}
		}

		// Token: 0x06001A89 RID: 6793 RVA: 0x000A8F7C File Offset: 0x000A717C
		public void Reset(int _mode)
		{
			switch (_mode)
			{
			case 0:
				this.cameraData.Copy(this.cameraReset);
				this.fieldOfView = this.cameraData.parse;
				break;
			case 1:
				this.cameraData.pos = this.cameraReset.pos;
				break;
			case 2:
				base.transform.rotation = this.cameraReset.rotation;
				break;
			case 3:
				this.cameraData.distance = this.cameraReset.distance;
				break;
			}
		}

		// Token: 0x06001A8A RID: 6794 RVA: 0x000A901C File Offset: 0x000A721C
		protected virtual bool InputMouseWheelZoomProc()
		{
			float num = Input.GetAxis("Mouse ScrollWheel") * this.zoomSpeed;
			if (num != 0f)
			{
				CameraControl.CameraData cameraData = this.cameraData;
				cameraData.distance.z = cameraData.distance.z + num;
				this.cameraData.distance.z = Mathf.Min(0f, this.cameraData.distance.z);
				return true;
			}
			return false;
		}

		// Token: 0x06001A8B RID: 6795 RVA: 0x000A908C File Offset: 0x000A728C
		protected virtual bool InputMouseProc()
		{
			bool result = false;
			float axis = Input.GetAxis("Mouse X");
			float axis2 = Input.GetAxis("Mouse Y");
			if ((!EventSystem.current || !EventSystem.current.IsPointerOverGameObject()) && (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(2)))
			{
				this.dragging = true;
			}
			else if (!Input.GetMouseButton(0) && !Input.GetMouseButton(1) && !Input.GetMouseButton(2))
			{
				this.dragging = false;
			}
			if (!this.dragging)
			{
				return false;
			}
			if (Input.GetMouseButton(0) && Input.GetMouseButton(1))
			{
				Vector3 zero = Vector3.zero;
				zero.x = axis * this.moveSpeed * this.rateAddSpeed;
				zero.z = axis2 * this.moveSpeed * this.rateAddSpeed;
				if (this.transBase != null)
				{
					this.cameraData.pos += this.transBase.InverseTransformDirection(base.transform.TransformDirection(zero));
				}
				else
				{
					this.cameraData.pos += base.transform.TransformDirection(zero);
				}
				result = true;
			}
			else if (Input.GetMouseButton(0))
			{
				Vector3 zero2 = Vector3.zero;
				zero2.y += axis * this.xRotSpeed * this.rateAddSpeed;
				zero2.x -= axis2 * this.yRotSpeed * this.rateAddSpeed;
				this.cameraData.rotate.y = (this.cameraData.rotate.y + zero2.y) % 360f;
				this.cameraData.rotate.x = (this.cameraData.rotate.x + zero2.x) % 360f;
				result = true;
			}
			else if (Input.GetMouseButton(1))
			{
				CameraControl.CameraData cameraData = this.cameraData;
				cameraData.pos.y = cameraData.pos.y + axis2 * this.moveSpeed * this.rateAddSpeed;
				CameraControl.CameraData cameraData2 = this.cameraData;
				cameraData2.distance.z = cameraData2.distance.z - axis * this.moveSpeed * this.rateAddSpeed;
				this.cameraData.distance.z = Mathf.Min(0f, this.cameraData.distance.z);
				result = true;
			}
			else if (Input.GetMouseButton(2))
			{
				Vector3 zero3 = Vector3.zero;
				zero3.x = axis * this.moveSpeed * this.rateAddSpeed;
				zero3.y = axis2 * this.moveSpeed * this.rateAddSpeed;
				if (this.transBase != null)
				{
					this.cameraData.pos += this.transBase.InverseTransformDirection(base.transform.TransformDirection(zero3));
				}
				else
				{
					this.cameraData.pos += base.transform.TransformDirection(zero3);
				}
				result = true;
			}
			return result;
		}

		// Token: 0x06001A8C RID: 6796 RVA: 0x000A93CC File Offset: 0x000A75CC
		protected virtual bool InputKeyProc()
		{
			bool flag = false;
			if (Input.GetKeyDown(KeyCode.A))
			{
				this.Reset(0);
			}
			else if (Input.GetKeyDown(KeyCode.Keypad5))
			{
				this.cameraData.rotate.x = this.cameraReset.rotate.x;
				this.cameraData.rotate.y = this.cameraReset.rotate.y;
			}
			else if (Input.GetKeyDown(KeyCode.Slash))
			{
				this.cameraData.rotate.z = 0f;
			}
			else if (Input.GetKeyDown(KeyCode.Semicolon))
			{
				this.fieldOfView = this.cameraReset.parse;
			}
			float deltaTime = Time.deltaTime;
			if (Input.GetKey(KeyCode.Home))
			{
				flag = true;
				CameraControl.CameraData cameraData = this.cameraData;
				cameraData.distance.z = cameraData.distance.z + deltaTime;
				this.cameraData.distance.z = Mathf.Min(0f, this.cameraData.distance.z);
			}
			else if (Input.GetKey(KeyCode.End))
			{
				flag = true;
				CameraControl.CameraData cameraData2 = this.cameraData;
				cameraData2.distance.z = cameraData2.distance.z - deltaTime;
			}
			if (Input.GetKey(KeyCode.RightArrow))
			{
				flag = true;
				if (this.transBase != null)
				{
					this.cameraData.pos += this.transBase.InverseTransformDirection(base.transform.TransformDirection(new Vector3(deltaTime, 0f, 0f)));
				}
				else
				{
					this.cameraData.pos += base.transform.TransformDirection(new Vector3(deltaTime, 0f, 0f));
				}
			}
			else if (Input.GetKey(KeyCode.LeftArrow))
			{
				flag = true;
				if (this.transBase != null)
				{
					this.cameraData.pos += this.transBase.InverseTransformDirection(base.transform.TransformDirection(new Vector3(-deltaTime, 0f, 0f)));
				}
				else
				{
					this.cameraData.pos += base.transform.TransformDirection(new Vector3(-deltaTime, 0f, 0f));
				}
			}
			if (Input.GetKey(KeyCode.UpArrow))
			{
				flag = true;
				if (this.transBase != null)
				{
					this.cameraData.pos += this.transBase.InverseTransformDirection(base.transform.TransformDirection(new Vector3(0f, 0f, deltaTime)));
				}
				else
				{
					this.cameraData.pos += base.transform.TransformDirection(new Vector3(0f, 0f, deltaTime));
				}
			}
			else if (Input.GetKey(KeyCode.DownArrow))
			{
				flag = true;
				if (this.transBase != null)
				{
					this.cameraData.pos += this.transBase.InverseTransformDirection(base.transform.TransformDirection(new Vector3(0f, 0f, -deltaTime)));
				}
				else
				{
					this.cameraData.pos += base.transform.TransformDirection(new Vector3(0f, 0f, -deltaTime));
				}
			}
			if (Input.GetKey(KeyCode.PageUp))
			{
				flag = true;
				CameraControl.CameraData cameraData3 = this.cameraData;
				cameraData3.pos.y = cameraData3.pos.y + deltaTime;
			}
			else if (Input.GetKey(KeyCode.PageDown))
			{
				flag = true;
				CameraControl.CameraData cameraData4 = this.cameraData;
				cameraData4.pos.y = cameraData4.pos.y - deltaTime;
			}
			float num = 10f * Time.deltaTime;
			Vector3 zero = Vector3.zero;
			if (Input.GetKey(KeyCode.Period))
			{
				flag = true;
				zero.z += num;
			}
			else if (Input.GetKey(KeyCode.Backslash))
			{
				flag = true;
				zero.z -= num;
			}
			if (Input.GetKey(KeyCode.Keypad2))
			{
				flag = true;
				zero.x -= num * this.yRotSpeed;
			}
			else if (Input.GetKey(KeyCode.Keypad8))
			{
				flag = true;
				zero.x += num * this.yRotSpeed;
			}
			if (Input.GetKey(KeyCode.Keypad4))
			{
				flag = true;
				zero.y += num * this.xRotSpeed;
			}
			else if (Input.GetKey(KeyCode.Keypad6))
			{
				flag = true;
				zero.y -= num * this.xRotSpeed;
			}
			if (flag)
			{
				this.cameraData.rotate.y = (this.cameraData.rotate.y + zero.y) % 360f;
				this.cameraData.rotate.x = (this.cameraData.rotate.x + zero.x) % 360f;
				this.cameraData.rotate.z = (this.cameraData.rotate.z + zero.z) % 360f;
			}
			float deltaTime2 = Time.deltaTime;
			if (Input.GetKey(KeyCode.Equals))
			{
				flag = true;
				this.fieldOfView = Mathf.Max(this.cameraData.parse - deltaTime2 * 15f, 1f);
			}
			else if (Input.GetKey(KeyCode.RightBracket))
			{
				flag = true;
				this.fieldOfView = Mathf.Min(this.cameraData.parse + deltaTime2 * 15f, this.limitFov);
			}
			return flag;
		}

		// Token: 0x06001A8D RID: 6797 RVA: 0x000A99C0 File Offset: 0x000A7BC0
		protected virtual void CameraUpdate()
		{
			if (this.isLimitDir)
			{
				this.cameraData.distance.z = Mathf.Clamp(this.cameraData.distance.z, -this.limitDir, 0f);
			}
			if (this.isLimitPos)
			{
				this.cameraData.pos = Vector3.ClampMagnitude(this.cameraData.pos, this.limitPos);
			}
			if (this.transBase != null)
			{
				base.transform.rotation = this.transBase.rotation * Quaternion.Euler(this.cameraData.rotate);
				base.transform.position = base.transform.rotation * this.cameraData.distance + this.transBase.TransformPoint(this.cameraData.pos);
			}
			else
			{
				base.transform.rotation = Quaternion.Euler(this.cameraData.rotate);
				base.transform.position = base.transform.rotation * this.cameraData.distance + this.cameraData.pos;
			}
			this.viewCollider.height = this.cameraData.distance.z;
			this.viewCollider.center = -Vector3.forward * this.cameraData.distance.z * 0.5f;
		}

		// Token: 0x06001A8E RID: 6798 RVA: 0x000A9B58 File Offset: 0x000A7D58
		public void TargetSet(Transform target, bool isReset)
		{
			if (target)
			{
				this.targetObj = target;
			}
			if (this.targetObj)
			{
				this.cameraData.pos = this.targetObj.position;
			}
			Transform transform = base.transform;
			this.cameraData.distance = Vector3.zero;
			this.cameraData.distance.z = -Vector3.Distance(this.cameraData.pos, transform.position);
			transform.LookAt(this.cameraData.pos);
			this.cameraData.rotate = base.transform.rotation.eulerAngles;
			if (isReset)
			{
				this.cameraReset.Copy(this.cameraData);
			}
		}

		// Token: 0x06001A8F RID: 6799 RVA: 0x000A9C24 File Offset: 0x000A7E24
		public void FrontTarget(Transform target, bool isReset, float dir = -3.4028235E+38f)
		{
			if (target)
			{
				this.targetObj = target;
			}
			if (this.targetObj)
			{
				target = this.targetObj;
				this.cameraData.pos = target.position;
			}
			if (!target)
			{
				return;
			}
			if (dir != -3.4028235E+38f)
			{
				this.cameraData.distance = Vector3.zero;
				this.cameraData.distance.z = -dir;
			}
			Transform transform = base.transform;
			transform.position = target.position;
			transform.rotation.eulerAngles.Set(this.cameraData.rotate.x, this.cameraData.rotate.y, this.cameraData.rotate.z);
			transform.position += transform.forward * this.cameraData.distance.z;
			transform.LookAt(this.cameraData.pos);
			this.cameraData.rotate = base.transform.rotation.eulerAngles;
			if (isReset)
			{
				this.cameraReset.Copy(this.cameraData);
			}
		}

		// Token: 0x06001A90 RID: 6800 RVA: 0x000A9D70 File Offset: 0x000A7F70
		public void SetCamera(Vector3 pos, Vector3 angle, Quaternion rot, Vector3 dir)
		{
			base.transform.localPosition = pos;
			base.transform.localRotation = rot;
			this.cameraData.rotate = angle;
			this.cameraData.distance = dir;
			this.cameraData.pos = -(base.transform.localRotation * this.cameraData.distance - base.transform.localPosition);
			this.cameraReset.Copy(this.cameraData);
		}

		// Token: 0x06001A91 RID: 6801 RVA: 0x000A9DFC File Offset: 0x000A7FFC
		public void SetBase(Transform _trans)
		{
			if (this.transBase == null)
			{
				return;
			}
			this.transBase.transform.position = _trans.position;
			this.transBase.transform.rotation = _trans.rotation;
		}

		// Token: 0x06001A92 RID: 6802 RVA: 0x000A9E3C File Offset: 0x000A803C
		public void ReflectOption()
		{
			this.rateAddSpeed = Studio.optionSystem.cameraSpeed;
			this.xRotSpeed = Studio.optionSystem.cameraSpeedX;
			this.yRotSpeed = Studio.optionSystem.cameraSpeedY;
			this.m_SubCamera.cullingMask = ((Studio.optionSystem.selectedState != 0) ? LayerMask.GetMask(new string[]
			{
				"Studio/Select"
			}) : LayerMask.GetMask(new string[]
			{
				"Studio/Col",
				"Studio/Select"
			}));
		}

		// Token: 0x06001A93 RID: 6803 RVA: 0x000A9EC8 File Offset: 0x000A80C8
		private void Awake()
		{
			this.m_MapLayer = -1;
		}

		// Token: 0x06001A94 RID: 6804 RVA: 0x000A9ED4 File Offset: 0x000A80D4
		private void Start()
		{
			this.mainCmaera = base.GetComponent<Camera>();
			this.fieldOfView = this.cameraReset.parse;
			this.zoomCondition = (() => false);
			this.isControlNow = false;
			if (this.isInit)
			{
				return;
			}
			if (!this.targetObj)
			{
				Vector3 a = base.transform.TransformDirection(Vector3.forward);
				this.cameraData.pos = base.transform.position + a * this.noneTargetDir;
			}
			this.TargetSet(this.targetObj, true);
			if (this.m_TargetTex == null)
			{
				this.m_TargetTex = base.transform.Find("CameraTarget");
			}
			if (this.m_TargetTex)
			{
				this.m_TargetTex.localScale = Vector3.one * 0.01f;
				if (this.m_TargetRender == null)
				{
					this.m_TargetRender = this.m_TargetTex.GetComponent<Renderer>();
				}
			}
			this.viewCollider = base.gameObject.AddComponent<CapsuleCollider>();
			this.viewCollider.radius = 0.05f;
			this.viewCollider.isTrigger = true;
			this.viewCollider.direction = 2;
			Rigidbody rigidbody = base.gameObject.AddComponent<Rigidbody>();
			rigidbody.useGravity = false;
			rigidbody.isKinematic = true;
			this.ReflectOption();
			this.isOutsideTargetTex = true;
			this.isConfigTargetTex = true;
			this.isCursorLock = true;
			this.listCollider.Clear();
			this.isInit = true;
		}

		// Token: 0x06001A95 RID: 6805 RVA: 0x000AA07C File Offset: 0x000A827C
		private void LateUpdate()
		{
			if (Singleton<Scene>.IsInstance() && (Singleton<Scene>.Instance.addSceneName != string.Empty || Singleton<Scene>.Instance.isNowLoadingFade))
			{
				return;
			}
			if (!this.isControlNow && Input.GetKey(KeyCode.B))
			{
				return;
			}
			this.isControlNow = false;
			this.xRotSpeed = Studio.optionSystem.cameraSpeedX;
			this.yRotSpeed = Studio.optionSystem.cameraSpeedY;
			if (!this.isControlNow)
			{
				this.isControlNow |= ((this.zoomCondition == null || this.zoomCondition()) && this.InputMouseWheelZoomProc());
			}
			if (!this.isControlNow && (this.noCtrlCondition == null || !this.noCtrlCondition()) && this.InputMouseProc())
			{
				this.isControlNow = true;
			}
			if (!this.isControlNow)
			{
				this.isControlNow |= ((this.keyCondition == null || this.keyCondition()) && this.InputKeyProc());
			}
			this.CameraUpdate();
			if (this.targetTex)
			{
				if (this.transBase != null)
				{
					this.targetTex.position = this.transBase.TransformPoint(this.cameraData.pos);
				}
				else
				{
					this.targetTex.position = this.cameraData.pos;
				}
				Vector3 position = base.transform.position;
				position.y = this.targetTex.position.y;
				this.targetTex.transform.LookAt(position);
				this.targetTex.Rotate(90f, 0f, 0f);
				if (this.m_TargetRender)
				{
					this.m_TargetRender.enabled = (this.isControlNow & this.isOutsideTargetTex & this.isConfigTargetTex);
				}
				if (Singleton<Manager.GameCursor>.IsInstance() && this.isCursorLock)
				{
					Singleton<Manager.GameCursor>.Instance.SetCursorLock(this.isControlNow & this.isOutsideTargetTex);
				}
			}
			this.VanishProc();
		}

		// Token: 0x06001A96 RID: 6806 RVA: 0x000AA2D4 File Offset: 0x000A84D4
		protected void OnTriggerEnter(Collider other)
		{
			if (other == null)
			{
				return;
			}
			if ((this.mapLayer & 1 << other.gameObject.layer) == 0)
			{
				return;
			}
			Collider x2 = this.listCollider.Find((Collider x) => other.name == x.name);
			if (x2 == null)
			{
				this.listCollider.Add(other);
			}
		}

		// Token: 0x06001A97 RID: 6807 RVA: 0x000AA358 File Offset: 0x000A8558
		protected void OnTriggerStay(Collider other)
		{
			if (other == null)
			{
				return;
			}
			if ((this.mapLayer & 1 << other.gameObject.layer) == 0)
			{
				return;
			}
			Collider x2 = this.listCollider.Find((Collider x) => other.name == x.name);
			if (x2 == null)
			{
				this.listCollider.Add(other);
			}
		}

		// Token: 0x06001A98 RID: 6808 RVA: 0x000AA3DC File Offset: 0x000A85DC
		protected void OnTriggerExit(Collider other)
		{
			this.listCollider.Clear();
		}

		// Token: 0x06001A99 RID: 6809 RVA: 0x000AA3EC File Offset: 0x000A85EC
		private void OnDrawGizmos()
		{
			Gizmos.color = ((this.cameraData.distance.z <= 0f) ? Color.blue : Color.red);
			Vector3 direction;
			if (this.transBase != null)
			{
				direction = this.transBase.TransformPoint(this.cameraData.pos) - base.transform.position;
			}
			else
			{
				direction = this.cameraData.pos - base.transform.position;
			}
			Gizmos.DrawRay(base.transform.position, direction);
		}

		// Token: 0x04001D37 RID: 7479
		private int m_MapLayer = -1;

		// Token: 0x04001D39 RID: 7481
		public Transform transBase;

		// Token: 0x04001D3A RID: 7482
		public Transform targetObj;

		// Token: 0x04001D3B RID: 7483
		public float xRotSpeed = 5f;

		// Token: 0x04001D3C RID: 7484
		public float yRotSpeed = 5f;

		// Token: 0x04001D3D RID: 7485
		public float zoomSpeed = 5f;

		// Token: 0x04001D3E RID: 7486
		public float moveSpeed = 0.05f;

		// Token: 0x04001D3F RID: 7487
		public float noneTargetDir = 5f;

		// Token: 0x04001D40 RID: 7488
		public bool isLimitPos;

		// Token: 0x04001D41 RID: 7489
		public float limitPos = 2f;

		// Token: 0x04001D42 RID: 7490
		public bool isLimitDir;

		// Token: 0x04001D43 RID: 7491
		public float limitDir = 10f;

		// Token: 0x04001D44 RID: 7492
		public float limitFov = 40f;

		// Token: 0x04001D45 RID: 7493
		[SerializeField]
		private Camera m_SubCamera;

		// Token: 0x04001D46 RID: 7494
		public CameraControl.NoCtrlFunc noCtrlCondition;

		// Token: 0x04001D47 RID: 7495
		public CameraControl.NoCtrlFunc zoomCondition;

		// Token: 0x04001D48 RID: 7496
		public CameraControl.NoCtrlFunc keyCondition;

		// Token: 0x04001D4A RID: 7498
		public readonly int CONFIG_SIZE = Enum.GetNames(typeof(CameraControl.Config)).Length;

		// Token: 0x04001D4B RID: 7499
		[SerializeField]
		protected CameraControl.CameraData cameraData = new CameraControl.CameraData();

		// Token: 0x04001D4C RID: 7500
		protected CameraControl.CameraData cameraReset = new CameraControl.CameraData();

		// Token: 0x04001D4D RID: 7501
		protected bool isInit;

		// Token: 0x04001D4E RID: 7502
		private const float INIT_FOV = 23f;

		// Token: 0x04001D4F RID: 7503
		protected CapsuleCollider viewCollider;

		// Token: 0x04001D50 RID: 7504
		protected float rateAddSpeed = 1f;

		// Token: 0x04001D51 RID: 7505
		private bool dragging;

		// Token: 0x04001D55 RID: 7509
		private bool m_ConfigVanish = true;

		// Token: 0x04001D56 RID: 7510
		[SerializeField]
		private Transform m_TargetTex;

		// Token: 0x04001D57 RID: 7511
		[SerializeField]
		private Renderer m_TargetRender;

		// Token: 0x04001D58 RID: 7512
		[SerializeField]
		private GameObject objRoot;

		// Token: 0x04001D59 RID: 7513
		private List<CameraControl.VisibleObject> lstMapVanish = new List<CameraControl.VisibleObject>();

		// Token: 0x04001D5A RID: 7514
		private List<Collider> listCollider = new List<Collider>();

		// Token: 0x02000430 RID: 1072
		// (Invoke) Token: 0x06001A9D RID: 6813
		public delegate bool NoCtrlFunc();

		// Token: 0x02000431 RID: 1073
		public class CameraData
		{
			// Token: 0x06001AA0 RID: 6816 RVA: 0x000AA4A4 File Offset: 0x000A86A4
			public CameraData()
			{
			}

			// Token: 0x06001AA1 RID: 6817 RVA: 0x000AA4D8 File Offset: 0x000A86D8
			public CameraData(CameraControl.CameraData _src)
			{
				this.Copy(_src);
			}

			// Token: 0x1700028F RID: 655
			// (get) Token: 0x06001AA2 RID: 6818 RVA: 0x000AA514 File Offset: 0x000A8714
			public Quaternion rotation
			{
				get
				{
					return Quaternion.Euler(this.rotate);
				}
			}

			// Token: 0x06001AA3 RID: 6819 RVA: 0x000AA524 File Offset: 0x000A8724
			public void Set(Vector3 _pos, Vector3 _rotate, Vector3 _distance, float _parse)
			{
				this.pos = _pos;
				this.rotate = _rotate;
				this.distance = _distance;
				this.parse = _parse;
			}

			// Token: 0x06001AA4 RID: 6820 RVA: 0x000AA544 File Offset: 0x000A8744
			public void Save(BinaryWriter _writer)
			{
				_writer.Write(2);
				_writer.Write(this.pos.x);
				_writer.Write(this.pos.y);
				_writer.Write(this.pos.z);
				_writer.Write(this.rotate.x);
				_writer.Write(this.rotate.y);
				_writer.Write(this.rotate.z);
				_writer.Write(this.distance.x);
				_writer.Write(this.distance.y);
				_writer.Write(this.distance.z);
				_writer.Write(this.parse);
			}

			// Token: 0x06001AA5 RID: 6821 RVA: 0x000AA600 File Offset: 0x000A8800
			public void Load(BinaryReader _reader)
			{
				int num = _reader.ReadInt32();
				this.pos.x = _reader.ReadSingle();
				this.pos.y = _reader.ReadSingle();
				this.pos.z = _reader.ReadSingle();
				this.rotate.x = _reader.ReadSingle();
				this.rotate.y = _reader.ReadSingle();
				this.rotate.z = _reader.ReadSingle();
				if (num == 1)
				{
					_reader.ReadSingle();
				}
				else
				{
					this.distance.x = _reader.ReadSingle();
					this.distance.y = _reader.ReadSingle();
					this.distance.z = _reader.ReadSingle();
				}
				this.parse = _reader.ReadSingle();
			}

			// Token: 0x06001AA6 RID: 6822 RVA: 0x000AA6CC File Offset: 0x000A88CC
			public void Copy(CameraControl.CameraData _src)
			{
				this.pos = _src.pos;
				this.rotate = _src.rotate;
				this.distance = _src.distance;
				this.parse = _src.parse;
			}

			// Token: 0x04001D5D RID: 7517
			private const int ver = 2;

			// Token: 0x04001D5E RID: 7518
			public Vector3 pos = Vector3.zero;

			// Token: 0x04001D5F RID: 7519
			public Vector3 rotate = Vector3.zero;

			// Token: 0x04001D60 RID: 7520
			public Vector3 distance = Vector3.zero;

			// Token: 0x04001D61 RID: 7521
			public float parse = 23f;
		}

		// Token: 0x02000432 RID: 1074
		public enum Config
		{
			// Token: 0x04001D63 RID: 7523
			MoveXZ,
			// Token: 0x04001D64 RID: 7524
			Rotation,
			// Token: 0x04001D65 RID: 7525
			Translation,
			// Token: 0x04001D66 RID: 7526
			MoveXY
		}

		// Token: 0x02000433 RID: 1075
		public class VisibleObject
		{
			// Token: 0x04001D67 RID: 7527
			public string nameCollider;

			// Token: 0x04001D68 RID: 7528
			public float delay;

			// Token: 0x04001D69 RID: 7529
			public bool isVisible = true;

			// Token: 0x04001D6A RID: 7530
			public List<GameObject> listObj = new List<GameObject>();
		}
	}
}
